package br.com.jvet.persistencia;

import java.util.List;

import javax.ejb.Stateless;
import javax.persistence.Query;

import br.com.jvet.constante.TipoServico;
import br.com.jvet.entidade.Servico;
@Stateless
public class ServicoDAO extends AbstractDAO<Servico, Integer> {

	public ServicoDAO() {
		super(Servico.class);
		
	}
	
	@SuppressWarnings("unchecked")
	public List<Servico> buscarPorTipoServico(TipoServico tipo) {
		
		Query c = super
				.getEntityManager()
				.createQuery(
						"SELECT s FROM "
								+ Servico.class.getSimpleName()
								+ " s "
								+ " where s.tipoServico =:tipo");
		c.setParameter("tipo", tipo);
		
		return (List<Servico>)c.getResultList();
	}
	

}
